﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;
using System.Data;
using fanfu.Model;
using fanfu.Business;
using fanfu.Common;

public partial class Article : BasePage
{
    //文章模型
    public ArticleModel articleModel = new ArticleModel();
    //该文章的所有评论信息
    public StringBuilder ReviewListHtml = new StringBuilder();

    protected void Page_Load(object sender, EventArgs e)
    {
        string ID = string.Empty;
        IPLocation ipLocation = new QQWryLocator().Query(Request.UserHostAddress);
        try
        {
            ID = Request["id"].ToString();
        }
        catch (Exception ex){ }

        //浏览量加一
        new ArticleRule().BrowserCountPlusOne(ID);
        //获取文章内容
        articleModel = new ArticleRule().GetArticleByID(ID);
        //获取评论列表信息
        ReviewListHtml = new ReviewRule().CreateReviewListHtml(ID,(int)ReviewParentType.article);

        this.Header.Title = articleModel.Caption + "&ndash;WEB前端开发&ndash;专注前端开发，关注用户体验";

        //存储当前文章的信息
        this.ParentId.Value = articleModel.ID.ToString();
        this.ParentName.Value = articleModel.Caption.ToString();
        this.ParentType.Value = ((int)ReviewParentType.article).ToString();
        this.ReviewerIP.Value = ipLocation.IP + ipLocation.Country + ipLocation.Local;
    }
}